<%@include file="/jsp/init.jspf" %>
<hunk:javascript src="${path}/js/app/category.js"/>
<layout:top menu="category"/>
<h1  class="pagetitle">Category</h1>
<div class="auto">
    <hunk:container>
        <hunk:validator form="categoryForm">
            <hunk:form action="category?action=save" name="categoryForm">
                <hunk:hidden name="id"/>
                <hunk:panel>
                    <hunk:text  name="description" label="Description"/>
                </hunk:panel>
                <hunk:panel>
                    <c:choose>
                        <c:when test="${not empty categoryForm.id}">
                            <hunk:submit label="Update"/>
                        </c:when>
                        <c:otherwise>
                            <hunk:submit label="Save"/>
                        </c:otherwise>
                        <hunk:submit label="Search"/>
                        <hunk:button label="Clear" styleClass="button" onclick="window.location='${path}/category.do?action=clear'"/>
                    </c:choose>
                </hunk:panel>
            </hunk:form>
        </hunk:validator>
    </hunk:container>
</div>

<display:table list="${categories}" class="display_table" id="item">
    <display:column title="Description">
        <div class="treeItem">
            <span>
                ${item.description}
            </span>
            <div class="float-right">
            </div>
            <span id="child_${item.id}" >
            </span>
        </div>
    </display:column>
    <display:column style="width:100px" title="Action">
        <a href="${path}/category.do?action=edit&id=${item.id}" title="Edit ${item.description}" class="icon_16 edit"></a>
        <a href="javascript:Confirm('Do you want to delete ?',deleteCategory,{'id':'${item.id}'})" title="Delete ${item.description}" class="icon_16 delete"></a>
    </display:column>
</display:table>

<layout:bottom/>
